package com.jzg.jcptadmin.presenter;

import com.jzg.jcptadmin.base.BasePresenter;
import com.jzg.jcptadmin.data.DataManager;
import com.jzg.jcptadmin.viewinterface.UpLoadCarImageInterface;

import rx.Subscription;

/**
 * Created by jzg on 2016/1/8.
 */
public class UpLoadImagePresenter extends BasePresenter<UpLoadCarImageInterface> {
    private DataManager dataManager;
    private UpLoadCarImageInterface mView;
    private Subscription mSubscription;
    public UpLoadImagePresenter(DataManager dataManager){

            this.dataManager = dataManager;

    }

    @Override
    public void attachView(UpLoadCarImageInterface mvpView) {
        super.attachView(mvpView);
        this.mView = mvpView;
    }
    @Override
    public void detachView() {
        super.detachView();
        if (mSubscription != null) mSubscription.unsubscribe();
    }

//    public void UpLoadImage(String path){
//
//        mSubscription = dataManager.UploadImage(path).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(new Observer<UpLoadImageData>() {
//            @Override
//            public void onCompleted() {
//
//            }
//
//            @Override
//            public void onError(Throwable e) {
//                if(e!=null){
//
//                    mView.showError(e.getMessage());
//                }
//            }
//
//            @Override
//            public void onNext(UpLoadImageData upLoadImageData) {
//                mView.showResult(upLoadImageData);
//            }
//        });
//    }
}
